<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title></title>
		<!--标准mui.css-->
		<link rel="stylesheet" href="css/mui.min.css">
		<link rel="stylesheet" type="text/css" href="css/css/mui.picker.min.css" />
		
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
			<a href="noticeList2.html" class="mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title">新建公告</h1>
			<a  class="mui-icon mui-icon-checkmarkempty mui-pull-right" onclick="notice()"></a>
		</header>
		
		<div class="mui-content">
			<input type="text" id="title" placeholder="标题（必填），4-30字">
		</div>
		<div class="">
			<textarea id="content" rows="8" placeholder="公告内容"></textarea>
		</div>

		<!--<script src="js/mui.min.js"></script></script>-->
		<!--<script src="js/mui.picker.min.js"></script>-->
		  <script src="js/mui.min.js"></script>
        <script src="js/mui.view.js "></script>
		<script src="js/mui.picker.min.js"></script>
		
		 
		
		<script src=" js/feedback1.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript" src="js/jquery-1.9.0.js"></script>	
		
		<script type="text/javascript">
			mui.init();
			var loginName=localStorage.getItem("loginName");
			
			//添加公告数据
			function notice(){
			var content=document.getElementById("content").value;
			var title=document.getElementById("title").value;
			
			if(content!=""&&title!=""){
			 
			var network=true;
			if(mui.os.plus) {
							mui.plusReady(function() {
								if(plus.networkinfo.getCurrentType() == plus.networkinfo.CONNECTION_NONE) {
									network = false;
								}
							});
						}
		 
			if(network){
					console.log('网络正常,正在发送请求...');
					
					mui.ajax({
						url:'http://113.71.26.27:8080/tpl/share1/notice1',
						async: true,
						type:'post',
						data:{
							
							title:title,
							content:content,
							loginName:loginName
							 
						},
						success:function(){
							window.location.href="noticeList2.html";
							mui.toast("发布成功");
						},
						error: function(xhr, type, errorThrown) {
									plus.nativeUI.toast(errorThrown);
						}
					});
					
			}else{
					mui.toast("当前网络不给力，请稍后再试...");
			}
		}
		else {
					plus.nativeUI.toast('输入不能为空！', {
						verticalAlign: 'center'
					});
		}
	}
			
			
				/**
		 * 重写返回事件
		 */
		mui.back = function(){
			
			window.location.href = "noticeList2.html";
		}
		</script>
		
	</body>

</html>